2022-11-28

Code

suppressMessages(library(plotly))
suppressMessages(library(Quandl))
# get the gold prices
gold <- Quandl("LBMA/GOLD")
# filter the column in USD
gold_2 <- gold[,c(1,2)]
# rename columns
colnames(gold_2) <- c("Date","USD")
# plot
plot_ly(gold_2, x=~Date, y=~USD, type = 'scatter', mode = 'lines') %>% 
  layout(title = "LBMA Gold Price (USD per fine troy ounce)")

Plot